<template>
	<view class="invite">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">我的邀请</block>
		</cu-custom>		
		<view class="top"><image src="/static/invite.jpg"></image></view>
		<view class="main">
			<block v-if="!status">
				<view class="tip">您已经是推广员啦~</view>
				<view class="share"><button type="warn" open-type="share">邀请更多小伙伴</button></view>				
			</block>
			<view class="desc">
				<view class="p">
					<view class="t">一、如何成为推广员：</view>
					<view class="s">1.由其他推广员推荐，成为他的下级推广员</view>
					<view class="s">2.在商城消费满<text>{{ total }}</text>元即可成为推广员，您目前已累消费<text>{{ consume }}</text>元</view>
				</view>
				<view class="p">
					<view class="t">二、推广员特权：</view>
					<view class="s">1.邀请好友成为你的下级推广员，好友在商城消费后你会得到部分奖励</view>
				</view>				
			</view>
		</view>		
	</view>
</template>

<script>
	import { Prom, BePromoters } from '@/common/api/lbt'
	export default {
		name: 'invite',
		data () {
			return {
				status: 0,
				total: 0,
				consume: 0
			}
		},
		onLoad () {
			this.getList()
		},
		methods: {
			async getList () {
				uni.showLoading()
				await this.getProm()
				await this.getPromoters()
				uni.hideLoading()
			},
			getProm () {
				return new Promise(resolve => {
					Prom().then(res => {
						this.status = res.code
						resolve()
					})					
				})
			},
			getPromoters () {
				return new Promise(resolve => {
					BePromoters().then(res => {
						this.total = this.utils.Fxied(res.auto_upgrade_money_2 || 0)
						this.consume = this.utils.Fxied(res.num_money || 0)
						
						resolve()
					})
				})
			}
		}
	}
</script>

<style lang="less">
	@import '../../common/styles/variables.less';
	.fixedBody;
	 page {
		 background-color: #475ebc
	 }
	.invite {
		.top {
			image {
				width: 100%
			}
		}
		.main {
			.tip {
				color:white;
				text-align: center;
				padding: 20upx 0;
				font-size: @minSize;
			}
			.share {
				margin: 0 15upx;
			}
			.desc {
				margin: 20upx 15upx;
				.p {
					.t {
						color: #ffc1c1;
						padding: 20upx 0;
					}
					.s {
						color: #bbb;
						font-size: @minSize;
						line-height: 1.5;
						text {
							font-size: @medium;
							color: #ffc1c1;
							font-weight: 600;
							padding: 0 4upx;
						}
					}
				}
			}
		}
	}
</style>
